def max_area(heights: list[int]):
    result = 0

    left = 0
    right = len(heights) - 1
    while left < right:
        left_value = heights[left]
        right_value = heights[right]

        left_is_smaller = left_value < right_value

        current_result = (right - left) * (left_value if left_is_smaller else right_value)
        result = max(result, current_result)

        d_value = 1 if left_is_smaller else 0
        left += d_value
        right += d_value - 1

    return result


def _main():
    input_list: list[int] = eval(input())
    print(max_area(input_list))


if __name__ == "__main__":
    _main()
